package com.xq.demo;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class JsoupDemo {

    public static void main(String[] args)  throws Exception {
        Document document = Jsoup.connect("https://sh.fang.anjuke.com/loupan/all/").get();
        Elements elements = document.select("div[class=key-list imglazyload] div[class=item-mod]")
                ;
        elements.forEach(c->{
           Element element = c.select(".pic img").get(0);
           String pic =  element.attr("src");
           System.out.println(pic);
            Element element2 = c.select(".infos span").get(0);
            String title =  element2.html();
            System.out.println(title);
            Element element3 = c.select(".infos .address span").get(0);
            String address =  element3.text();
            System.out.println(address);
            Element element4 = c.select(".infos .huxing").get(0);
            String huixng =  element4.text();
            System.out.println(huixng);
            Element element5 = c.select(".favor-pos p").get(0);
            String price =  element5.text();
            System.out.println(price);

        });



    }
}
